﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Data;

namespace tomvangaever.CorrelationWebPart.Test
{
    [TestClass]
    public class SPCorelationIDServiceTest
    {
        [TestMethod]
        public void TestULSValid()
        {
            SPCorelationIDService service = new SPCorelationIDService();
            var logfolder = @"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS";
            var corrId = new Guid("e2138aad-ef95-4bac-a5bf-dc379dc34b1b");
            var result = service.GetLogsByCorrelationId(corrId, logfolder);
            int notcorrect = result.Count;
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void TestULS_WrongFolder()
        {
            SPCorelationIDService service = new SPCorelationIDService();
            var logfolder = @"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\11\LOGS";
            var corrId = Guid.NewGuid();
            var result = service.GetLogsByCorrelationId(corrId, logfolder);
            int notcorrect = result.Count;
        }

        [TestMethod]
        public void TestULS_WrongToken()
        {
            SPCorelationIDService service = new SPCorelationIDService();
            var logfolder = @"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS";
            var corrId = Guid.NewGuid();
            var result = service.GetLogsByCorrelationId(corrId, logfolder);
            int notcorrect = result.Count;
            Assert.AreEqual(0, notcorrect);
        }
    }
}
